import request from '@/utils/request'

// 获取角色管理数据
export const getRoleManagementData = params => {
  return request({
    url: `/permission/role`,
    method: 'GET',
    params
  })
}
// 根据id获取角色数据
export const getRoleDataAccordingToId = id => {
  return request({
    url: `permission/role/${id}`,
    method: 'GET'
  })
}

// 获取权限数据
export const getPermissionData = () => {
  return request({
    url: '/permission/menu',
    method: 'GET'
  })
}

// 新增角色
export const newRole = data => {
  return request({
    url: '/permission/role',
    method: 'POST',
    data
  })
}

// 根据id修改角色数据
export const modifyRoleDataAccordingToId = data => {
  return request({
    url: `/permission/role/${data.id}`,
    method: 'PUT',
    data
  })
}

// 根据id删除角色
export const deleteRoleAccordingToId = id => {
  return request({
    url: `/permission/menu/${id}`,
    method: 'DELETE'
  })
}

// 根据角色名称查找角色数据
export const findRoleData = params => {
  return request({
    url: `/permission/role/`,
    method: 'GET',
    params
  })
}

